<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>【案例】数组去除重复元素</title>
    <script>
        function unique(arr){
            var newArr = [];
            for(var i = 0; i < arr.length; i++){
                if(newArr.indexOf(arr[i]) === -1){
                    newArr.push(arr[i]);
                }
            }
            return newArr;
        }
        var demo = unique(['blue','green','blue']);
        console.log(demo);
    </script>
</head>
<body>

</body>
</html>